package controllers;

import java.util.List;

import models.Arcadiano;
import models.TipoEvento;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import play.mvc.With;

@With(Secure.class)
public class Arcadianos extends ArcadiaCRUD {

	public static void search(String nombre) {
		String[] result = new String[2];
		String query = "UPPER(nombre) like '%";
		query = query.concat(nombre.toUpperCase());
		query = query.concat("%'");
		List<Arcadianos> arcadianos = Arcadiano.find(query).fetch();

		Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
		String json = gson.toJson(arcadianos);
		result[0] = "OK";
		result[1] = json;
		renderJSON(result);
	}
}
